﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Portal.Controllers
{
    public class TestController:Controller
    {
        private readonly ILogger<TestController> _logger;

        public TestController(ILogger<TestController> logger)
        {
            _logger = logger;
        }

        public IActionResult Back()
        {
            _logger.LogInformation("back方法被调用了1.");  //将日志发送到控制台上 info级别
            _logger.LogInformation("back方法被调用了2.");
            _logger.LogError("严重错误");
            return Json(new
            {
                Msg = "返回信息"
            });
        }
        
    }
}